import { http } from '@/utils/request'
import type {
  Notification,
  NotificationQueryRequest,
  UpdateRequest,
  BaseResponse,
  PageResponse
} from '@/types'

// 分页获取通知列表
export const getNotificationList = (data: NotificationQueryRequest): Promise<BaseResponse<PageResponse<Notification>>> => {
  return http.post('/notification/list/page', data)
}

// 获取未读通知数量
export const getUnreadCount = (): Promise<BaseResponse<number>> => {
  return http.post('/notification/unread/count')
}

// 标记通知为已读
export const markAsRead = (data: UpdateRequest): Promise<BaseResponse<boolean>> => {
  return http.post('/notification/read', data)
}

// 标记所有通知为已读
export const markAllAsRead = (): Promise<BaseResponse<boolean>> => {
  return http.post('/notification/read/all')
}
